<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ event.name }} - {{ ("Order List") }}</title>
    <style type="text/css">
        {% include 'bootstrap/bootstrap_pdf.css' %}
        table th {
            text-align: left;
        }

        table td {
            text-align: left;
            border-spacing: 1em;
        }

        table {
            margin-top: 20px;
            border-collapse: separate;
        }

        .total-row {
            margin-top: 25px;
        }

        .order-total {
            margin-right: 50px;
        }

        tr.padded td{
        padding-top : 40px;
        }
    </style>
</head>
<body id="body">
<h3 style="text-align:center;">{{ event.name }} - {{ ("Order List") }}</h3>
    <br>
    <table class="table with-datatable" id="orders-table" width="100%">
        <thead>
        <tr>
            <th>
                {{ ("Order") }}
            </th>
            <th>
                {{ ("Order Details") }}
            </th>
            <th>
                {{ ("User") }}
            </th>
            <th>
                {{ ("User Details") }}
            </th>
        </tr>
        </thead>
        <tbody>
        {% for order in orders %}
            {% if order.status != "deleted" %}
                <tr class="padded">
                    <td><br>
                            Order Number    :<br>
                            Order By        :<br>
                            Order Status    :<br>
                            Quantity        :<br>
                            Total Amount    :<br>
                            Payment Mode    :<br>
                            Discount Code   :<br>
                        {% if order.status == 'completed' %}
                            Order Completed :<br>
                        {% else %}
                            Order Placed    :<br>
                        {% endif %}
                    </td>
                    <td><br>
                            <strong>{{ order.get_invoice_number() }}</strong><br>
                            {% if order.user and order.user.first_name and order.user.last_name %}
                                {{ order.user.fullname }}
                            {% elif order.user %}
                                {{ order.user.email }}
                            {% else %}
                                {{ ('Information unavailable') }}
                            {% endif %}<br>
                            {% if order.status == 'completed' %}
                                {{ order.status | capitalize }}
                            {% elif order.status == 'pending' or order.status == 'initialized' %}
                                {{ ("Pending") }}
                            {% elif order.status == 'placed' %}
                                {{ order.status | capitalize }}
                            {% elif order.status == 'cancelled' %}
                                {{ order.status | capitalize }}
                            {% else %}
                                {{ order.status | capitalize }}
                            {% endif %}<br>
                            {{ order.tickets_count }}<br>
                            {{ event.payment_currency }}{{ order.amount | money }}<br>
                            {% if order.status == 'completed' %}
                                {{ order.paid_via | capitalize }}
                            {% else %}
                                {{ ('Payment pending') }}
                            {% endif %}<br>
                            {% if order.discount_code %}
                                {{ order.discount_code.code }}<br>
                            {% else %}
                                {{ ('NA') }}
                            {% endif %}<br>
                            {% if order.status == 'completed' %}
                                <span class="datetime">{{ order.completed_at | datetime }}</span>
                            {% else %}
                                <span class="datetime">{{ order.created_at | datetime }}</span>
                            {% endif %}<br>
                    </td>
                    <td style="text-align:center;"><br>
                        <strong>
                        First Name   :<br>
                        Last Name    :<br>
                        Email       :<br>
                        </strong>
                    </td>
                    <td><br>
                            <strong>
                            {{ order.user.first_name if order.user and order.user.first_name }}<br>
                            {{ order.user.last_name if order.user and order.user.last_name}}<br>
                            {{ order.user.email if order.user and order.user.email}}<br>
                            </strong>
                    </td>
                </tr>
            {% endif %}
        {% endfor %}
        </tbody>
    </table>
</body>
</html>
